package com.iteaj.iot.server;

import com.iteaj.iot.ProtocolTimeoutManager;
import com.iteaj.iot.builder.AbstractBuilder;
import com.iteaj.iot.builder.Builder;
import com.iteaj.iot.builder.ComponentBuilder;
import com.iteaj.iot.codec.filter.CombinedInterceptor;

public class ServerBuilder extends AbstractBuilder<SocketServerComponent, ServerEventListener> {

    protected ServerBuilder() { }

    public static ServerBuilder builder() {
        return new ServerBuilder();
    }

    @Override
    public Builder listener(ServerEventListener listener) {
        return this.setListener(listener);
    }

    @Override
    public ComponentBuilder<ServerProtocolHandle, CombinedInterceptor> register(SocketServerComponent component) {
        return new ComponentBuilder(component, this);
    }

    @Override
    public ServerBuilder customize(ProtocolTimeoutManager timeoutManager) {
        return (ServerBuilder) this.setTimeoutManager(timeoutManager);
    }

}
